package com.pay.enums;

/**
 * @author 周益和
 * @ClassName PaymentEnum
 * @qq 1552951165
 */
public enum PaymentEnum {
    ALIPAY("支付宝"),
    UNIONPAY("银联");
    
    private final String value;
    
    PaymentEnum(String value) {
        this.value = value;
    }
    
    /**
     * 根据枚举的name找到对应的value
     * @param name
     * @return
     */
    public static String find(String name){
        for (PaymentEnum paymentEnum : PaymentEnum.values()) {
            if(name.equals(paymentEnum.name())){
                return paymentEnum.value;
            }
        }
        return null;
    }
    
    public static void main(String[] args) {
        System.out.println(PaymentEnum.ALIPAY.value);
        System.out.println(PaymentEnum.ALIPAY.name());
        String s = find("ALIPAY");
        System.out.println(s);
    }
}
